package com.sky.mapper;

import com.sky.entity.DishFlavor;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Mapper
public interface DishFlavourMapper {

    void insertDishFlavour(List<DishFlavor> flavors);

    /**
     * 删除果蔬关联的果蔬口味信息
     * @param ids
     */
    void deleteDishFlavourByDishIds(List<Long> dishIds);

    /**
     * 根据果蔬id查询果蔬口味信息
     * @param dishId
     * @return List<DishFlavor>
     */
    @Select("SELECT id, dish_id, name, value FROM dish_flavor WHERE dish_id = #{dishId}")
    List<DishFlavor> selectDishFlavourByDishId(Long dishId);

    /**
     * 根据果蔬ID删除果蔬口味信息
     * @param dishId
     */
    @Delete("delete from dish_flavor where dish_id = #{dishId}")
    void deleteDishFlavourByDishId(Long dishId);
}
